<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>关键字查询自我展示</title>
    <link rel="stylesheet" href="https://cache.amap.com/lbs/static/main1119.css"/>
    <link rel="stylesheet" href="https://cache.amap.com/lbs/static/AMap.PlaceSearchRender1120.css"/>
    <style>
        #panel {
            z-index: 999;
            position: absolute;
            background-color: white;
            max-height: 100%;
            overflow-y: auto;
            right: 0;
            width: 280px;
        }
    </style>
    <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.9&key={$key}&plugin=AMap.PlaceSearch"></script>
    <script type="text/javascript" src="https://cache.amap.com/lbs/static/PlaceSearchRender.js"></script>
    <script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script>
</head>
<body>
<div id="container"></div>
<div id="panel"></div>
<script type="text/javascript">
    var map = new AMap.Map("container", {
        resizeEnable: true
    });
    var placeSearchOptions = { //构造地点查询类
        pageSize: 5,
        pageIndex: 1,
        city: "{$address}" //城市
    };
    var placeSearch = new AMap.PlaceSearch(placeSearchOptions);
    //关键字查询，您如果想修改结果展现效果，请参考页面：https://lbs.amap.com/fn/css-style/
    placeSearch.search("{$address}", callback);
    var placeSearchRender=new Lib.AMap.PlaceSearchRender();
    function callback(status, result) {
        if (status === 'complete' && result.info === 'OK') {
            placeSearchRender.autoRender({
                placeSearchInstance: placeSearch,
                methodName: "search",
                methodArgumments: ["{$address}", callback],
                data: result,
                map: map,
                panel: "panel"
            });
        }
    }
</script>
</body>
</html>